package com.example.capturetheflag.createGame;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import com.example.capturetheflag.R;
import com.example.capturetheflag.connection.HttpPostCreateGameRequest;
import com.example.capturetheflag.helper.Singleton;

public class CreateMenuActivity extends Activity {
	
	private EditText gameName;
	private EditText playersCount;
	private EditText pointsCount;
	private Dialog dialog;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_create_menu);
    }
    
    public void onButtonNextClick(View view){
    	
    	gameName = (EditText)findViewById(R.id.gameName);
		playersCount = (EditText)findViewById(R.id.players);
		pointsCount = (EditText)findViewById(R.id.maxPoints);
		Singleton.getInstance().gameID = null;
		
		HttpPostCreateGameRequest httpPostRequest = new HttpPostCreateGameRequest(getApplicationContext(),this);
		httpPostRequest.execute("http://proinz.studentlive.pl/GeoService.svc/CreateGame","CreateGame"
				, gameName.getText().toString(), playersCount.getText().toString(), pointsCount.getText().toString());
		
		dialog = new Dialog(this);
        dialog.setTitle("Please wait for the connection");
        dialog.show();
        dialog.setCancelable(false);
    }
}
